﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.ServiceModel;
using System.Web.Http;

namespace ERPStore.Web.Controllers
{
	[System.Web.Http.Description.ApiExplorerSettings(IgnoreApi = true)]
	public class EmailerApiController : ApiController
	{
		public EmailerApiController(ERPStore.Services.IEmailerService emailerService)
		{
			this.EmailerService = emailerService;
		}

		protected ERPStore.Services.IEmailerService EmailerService { get; set; }

		[ActionFilters.ApiAuthorizedOperation]
		[System.Web.Http.HttpGet]
		[System.Web.Http.HttpPost]
		public bool Send(ERPStore.Models.MailMessage mailTemplate)
		{
			EmailerService.Send(mailTemplate, mailTemplate.StartDate);
			return true;
		}

	}
}
